﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditorIndex.aspx.cs" Inherits="RichECMS.ServerPages.CoderEditor.EditorIndex" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="Source/Commoncss.css" rel="stylesheet" type="text/css" />
    <script src="../../sysCommon/sysScripts/jquery/1.7.2/Jquery.js" type="text/javascript"></script>
    <link href="wdScrollTab/css/TabPanel.css" rel="stylesheet" type="text/css" />
    <script src="wdScrollTab/Plugins/Fader.js" type="text/javascript"></script>
    <script src="wdScrollTab/Plugins/TabPanel.js" type="text/javascript"></script>
    <script src="wdScrollTab/Plugins/Math.uuid.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        var tabpanel;
        $(document).ready(function () {
            //            $("#mainFrame").css("height", ($(window).height() - 124) + "px");
            //            $(window).resize(function () {
            //                $("#mainFrame").css("height", ($(window).height() - 124) + "px");
            //                $("#alertParent").css({ "width": $("body").width() + "px", "height": $("body").height() + "px" });
            //            });

            tabpanel = new TabPanel({
                renderTo: 'tab',
                width: $("#mainright").width(),
                height: $("#mainright").height(),
                //border:'none',  
                active: 0,
                items:[]
            });
            //tabpanel.addTab({ id: 'toolbarPlugin4', title: 'Disabled', html: "pp", closable: true, disabled: false });
            //console.dir(tabpanel);
        });

        function changeframelink(link, name) {
            var tabWidth = tabpanel.width - 16;
            var Request = new Object();
            var lintsize = link.split("?").length;
            if (lintsize>1) {
                var linkstr = link[1];
                if ((linkstr.indexOf(".css") != -1) || (linkstr.indexOf(".js") != -1) || (linkstr.indexOf(".aspx") != -1) || (linkstr.indexOf(".cs") != -1) || (linkstr.indexOf(".ashx") != -1) || (linkstr.indexOf(".htm") != -1) || (linkstr.indexOf(".html") != -1) || (linkstr.indexOf(".shtml") != -1) || (linkstr.indexOf(".xml") != -1) || (linkstr.indexOf(".php") != -1)) {
                    var iframestring = '<iframe id="editorIframe' + new Date().getTime() + '" src="' + link + "&width=" + tabWidth + '" style="width: 100%;height:419px; border: 0px;"></iframe>';
                    var tavstr = { id: "tab" + new Date().getTime(), title: name, html: iframestring, closable: true, disabled: false };
                    tabpanel.addTab(tavstr);
                }
                else {
                    alert(link.replace(/CodeEditor.aspx?filepath=/, ""));
                    var iframestring = '<iframe id="editorIframe' + new Date().getTime() + '" src="' + unescape(link.replace(/CodeEditor.aspx?filepath=/, "")) + '" style="width: 100%;height:419px; border: 0px;"></iframe>';
                    var tavstr = { id: "tab" + new Date().getTime(), title: name, html: iframestring, closable: true, disabled: false };
                    tabpanel.addTab(tavstr);
                }
            }   
        }

        function changeWindowlink(linkstr) {
            window.parent.location = linkstr;
        }
    </script>
    <style type="text/css">
        .left
        {
            width: 250px;
            height: 430px;
        }
        #mainleft
        {
            border: 0px solid #ccc;
            height:100%;
        }
        #mainright
        {
            height: 100%;
        }
        .maintable
        {
            border:0px solid #ccc;
            }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <table class="maintable" style="width: 100%; height: 100%;">
        <tr>
            <td class="left" valign="top">
                <div id="mainleft">
                    <iframe id="FileTreeIframe" src="FileTree.aspx" style="width: 100%; height: 100%;
                        border: 0px;"></iframe>
                </div>
            </td>
            <td id="mainright" class="right" valign="top">
                <div id="tab">
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
